<html>
<head>
    @include('v1.common.meta')
    <link rel="stylesheet" href="{{elixir('css/basicdata.css')}}">
</head>
<body>
<div class="yjs-grid">
    <div class="yjs-grid-box">
        <div class="layui-tab">
            @if(Auth::check())
                <div class="layui-container">
                    @if($view==='viewData')
                        {{--查看视图--}}
                        <div class="layui-row">
                            <div class="layui-col-md12">
                                <fieldset class="layui-elem-field">
                                    <legend>查看【{{$itemData['name']}}】变电站信息</legend>
                                    <div class="layui-field-box">
                                        <div class="layui-row hidden-tips">
                                            <div class="layui-col-md12">
                                                <blockquote class="layui-elem-quote">
                                                    温馨提示：查看数据时，所有表单项均不可修改。
                                                </blockquote>
                                            </div>
                                        </div>
                                        <div class="layui-form layui-form-pane">
                                            基本信息
                                            <hr class="layui-bg-green">
                                            <div class="layui-row">
                                                <div class="layui-col-md4">
                                                    &nbsp;
                                                </div>
                                                <div class="layui-col-md4">
                                                    <img width="150" height="150" src="{{$itemData['picture']}}"
                                                         class="layui-circle layim-msgbox-avatar"
                                                         alt="变电站照片">
                                                </div>
                                                <div class="layui-col-md4">
                                                    &nbsp;
                                                </div>
                                            </div>
                                            <div class="layui-row">
                                                <div class="layui-col-md6">
                                                    <div class="layui-form-item">
                                                        <label class="layui-form-label">变电站代码</label>
                                                        <div class="layui-input-inline">
                                                            <input type="text" value="{{$itemData['code']}}" disabled
                                                                   class="layui-input">
                                                        </div>
                                                    </div>
                                                </div>
                                                <div class="layui-col-md6">
                                                    <div class="layui-form-item">
                                                        <label class="layui-form-label">变电站编号</label>
                                                        <div class="layui-input-inline">
                                                            <input type="text" value="{{$itemData['name']}}" disabled
                                                                   class="layui-input">
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="layui-row">
                                                <div class="layui-col-md4">
                                                    <div class="layui-form-item">
                                                        <label class="layui-form-label">所属客户</label>
                                                        <div class="layui-input-inline">
                                                            <input type="text" value="{{$itemData['customer_code']}}" disabled
                                                                   class="layui-input">
                                                        </div>
                                                    </div>
                                                </div>
                                                <div class="layui-col-md4">
                                                    <div class="layui-form-item">
                                                        <label class="layui-form-label">位置</label>
                                                        <div class="layui-input-inline">
                                                            <input type="text" value="{{$itemData['address']}}" disabled
                                                                   class="layui-input">
                                                        </div>
                                                    </div>
                                                </div>
                                                <div class="layui-col-md4">
                                                    <div class="layui-form-item">
                                                        <label class="layui-form-label">备注</label>
                                                        <div class="layui-input-inline">
                                                            <input type="text" value="{{$itemData['remark']}}" disabled
                                                                   class="layui-input">
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="layui-row">
                                                <div class="layui-col-md6">
                                                    <div class="layui-form-item">
                                                        <label class="layui-form-label">创建时间</label>
                                                        <div class="layui-input-inline">
                                                            <input type="text" value="{{$itemData['created_at']}}"
                                                                   disabled class="layui-input">
                                                        </div>
                                                    </div>
                                                </div>
                                                <div class="layui-col-md6">
                                                    <div class="layui-form-item">
                                                        <label class="layui-form-label">更新时间</label>
                                                        <div class="layui-input-inline">
                                                            <input type="text" value="{{$itemData['updated_at']}}"
                                                                   disabled class="layui-input">
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </fieldset>
                            </div>
                        </div>
                    @elseif($view=='addData')
                        {{--新增图文视图--}}
                        <div class="layui-row">
                            <div class="layui-col-md12">
                                <fieldset class="layui-elem-field">
                                    <legend>新增变电站</legend>
                                    <div class="layui-field-box">
                                        <div class="layui-row hidden-tips">
                                            <div class="layui-col-md12">
                                                <blockquote class="layui-elem-quote">
                                                    温馨提示：新增数据时，存在"<i class="layui-icon">&#xe605;</i>"标识的表单项，建议您自主编辑维护；
                                                </blockquote>
                                            </div>
                                        </div>
                                        <div class="layui-form layui-form-pane" name="substationsForm"
                                             action="javascript:;" method="POST">
                                            <input type="hidden" name="viewType" value="{{$view}}">
                                            <input type="hidden" name="code" value="{{$randomCode}}">
                                            <input type="hidden" name="customers" value="{{$customers}}">
                                            基本信息
                                            <hr class="layui-bg-green">
                                            <div class="layui-row">
                                                <div class="layui-col-md6">
                                                    <div class="layui-form-item">
                                                        <label class="layui-form-label">变电站代码</label>
                                                        <div class="layui-input-inline">
                                                            <input type="text" value="{{$randomCode}}" disabled
                                                                   class="layui-input">
                                                        </div>
                                                    </div>
                                                </div>
                                                <div class="layui-col-md6">
                                                    <div class="layui-form-item">
                                                        <label class="layui-form-label"><i class="layui-icon">&#xe605;</i>变电站编码</label>
                                                        <div class="layui-input-inline">
                                                            <input type="text" name="name" required
                                                                   lay-verify="required|name"
                                                                   placeholder="请输入变电站编码"
                                                                   class="layui-input">
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="layui-row">
                                                <div class="layui-col-md6">
                                                    <div class="layui-form-item">
                                                        <label class="layui-form-label"><i
                                                                    class="layui-icon">&#xe605;</i>所属客户</label>
                                                        <div class="layui-input-inline">
                                                            <select id="customer_code" name="customer_code"
                                                                    lay-filter="customerSel" lay-verify="required"
                                                                    lay-search="">
                                                                <option value="">直接选择或搜索选择</option>
                                                                @foreach($customers as $customer)
                                                                    <option value="{{$customer["code"]}}">{{$customer["name"]}}</option>
                                                                @endforeach
                                                            </select>
                                                        </div>
                                                    </div>
                                                </div>
                                                <div class="layui-col-md6">
                                                    <div class="layui-form-item">
                                                        <label class="layui-form-label"><i
                                                                    class="layui-icon">&#xe605;</i>位置</label>
                                                        <div class="layui-input-inline">
                                                            <input type="text" name="address" required
                                                                   lay-verify="required|address"
                                                                   placeholder="请输入变电站位置"
                                                                   class="layui-input">
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="layui-row">
                                                <div class="layui-col-md6">
                                                    <div class="layui-form-item">
                                                        <label class="layui-form-label"><i class="layui-icon">&#xe605;</i>备注</label>
                                                        <div class="layui-input-inline">
                                                            <input type="text" name="remark"
                                                                   placeholder="请输入备注" class="layui-input">
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                            变电站图片
                                            <hr class="layui-bg-blue">
                                            <div class="layui-row">
                                                <div class="layui-col-md12">
                                                    <div class="layui-collapse">
                                                        <div class="layui-colla-item">
                                                            <h2 class="layui-colla-title">限制规则：</h2>
                                                            <div class="layui-colla-content">
                                                                <p>1.要求：本人正面照片，内容合规合法；</p>
                                                                <p>2.格式：jpg、png、bmp、jpeg</p>
                                                                <p>3.尺寸：91x91</p>
                                                                <p>4.大小：少于2MB</p>
                                                            </div>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="layui-row">
                                                <div class="layui-col-md1">
                                                    &nbsp;
                                                </div>
                                                <div class="layui-col-md10">
                                                    <div class="layui-upload-drag" id="substationPicture">
                                                        <i class="layui-icon">&#xe681;</i>
                                                        <p>点击上传，或将文件拖拽到此处</p>
                                                    </div>
                                                </div>
                                                <div class="layui-col-md1">
                                                    &nbsp;
                                                </div>
                                            </div>
                                            <div class="layui-row">
                                                <div class="layui-col-md3">
                                                    &nbsp;
                                                </div>
                                                <div class="layui-col-md6">
                                                    <div class="layui-upload-list yjs-photo"
                                                         id="substationViewer"  style="display: none">
                                                        <img class="layui-upload-img">
                                                        <div class="yjs-photo-edit">点击查看原图</div>
                                                    </div>
                                                </div>
                                                {{--保存上传的图片路径--}}
                                                <div class="layui-col-md6" style="display:none; width: auto;">
                                                    <div class="layui-form-item">
                                                        <input type="text" name="picture" class="layui-input">
                                                    </div>
                                                </div>
                                                <div class="layui-col-md3">
                                                    &nbsp;
                                                </div>
                                            </div>
                                            <div class="layui-row">
                                                <div class="layui-col-md3">
                                                    {{--隐藏提交--}}
                                                    <button id="toolbarSubmit" type="submit" class="layui-btn"
                                                            lay-filter="toolbarEvent" lay-submit style="display: none;">
                                                    </button>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </fieldset>
                            </div>
                        </div>
                    @elseif($view=='editData')
                        {{--编辑图文视图--}}
                        <div class="layui-row">
                            <div class="layui-col-md12">
                                <fieldset class="layui-elem-field">
                                    <legend>编辑变电站</legend>
                                    <div class="layui-field-box">
                                        <div class="layui-row hidden-tips">
                                            <div class="layui-col-md12">
                                                <blockquote class="layui-elem-quote">
                                                    温馨提示：编辑数据时，存在"<i class="layui-icon">&#xe605;</i>"标识的表单项，建议您自主编辑维护；
                                                </blockquote>
                                            </div>
                                        </div>
                                        <div class="layui-form layui-form-pane" name="substationsForm"
                                             action="javascript:;" method="POST">
                                            <input type="hidden" name="viewType" value="{{$view}}">
                                            <input type="hidden" name="code" value="{{$itemData['code']}}">
                                            <input type="hidden" name="customers" value="{{$customers}}">
                                            基本信息
                                            <hr class="layui-bg-green">
                                            <div class="layui-row">
                                                <div class="layui-col-md6">
                                                    <div class="layui-form-item">
                                                        <label class="layui-form-label">变电站代码</label>
                                                        <div class="layui-input-inline">
                                                            <input type="text" value="{{$itemData['code']}}" disabled
                                                                   class="layui-input">
                                                        </div>
                                                    </div>
                                                </div>
                                                <div class="layui-col-md6">
                                                    <div class="layui-form-item">
                                                        <label class="layui-form-label"><i class="layui-icon">&#xe605;</i>变电站编码</label>
                                                        <div class="layui-input-inline">
                                                            <input type="text" name="name" value="{{$itemData['name']}}" required
                                                                   lay-verify="required|name"
                                                                   placeholder="请输入变电站编码"
                                                                   class="layui-input">
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="layui-row">
                                                <div class="layui-col-md6">
                                                    <div class="layui-form-item">
                                                        <label class="layui-form-label"><i
                                                                    class="layui-icon">&#xe605;</i>所属客户</label>
                                                        <div class="layui-input-inline">
                                                            <select id="customer_code" name="customer_code"
                                                                    lay-filter="customerSel" lay-verify="required"
                                                                    lay-search="">
                                                                <option value="">直接选择或搜索选择</option>
                                                                @foreach($customers as $customer)
                                                                    @if($itemData['customer_code']===$customer['code'])
                                                                        <option value="{{$customer["code"]}}"
                                                                                selected>{{$customer["name"]}}</option>
                                                                    @else
                                                                    <option value="{{$customer["code"]}}">{{$customer["name"]}}</option>
                                                                    @endif
                                                                @endforeach
                                                            </select>
                                                        </div>
                                                    </div>
                                                </div>
                                                <div class="layui-col-md6">
                                                    <div class="layui-form-item">
                                                        <label class="layui-form-label"><i
                                                                    class="layui-icon">&#xe605;</i>位置</label>
                                                        <div class="layui-input-inline">
                                                            <input type="text" name="address" value="{{$itemData['address']}}" required
                                                                   lay-verify="required|address"
                                                                   placeholder="请输入变电站位置"
                                                                   class="layui-input">
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="layui-row">
                                                <div class="layui-col-md6">
                                                    <div class="layui-form-item">
                                                        <label class="layui-form-label"><i class="layui-icon">&#xe605;</i>备注</label>
                                                        <div class="layui-input-inline">
                                                            <input type="text" name="remark" value="{{$itemData['remark']}}"
                                                                   placeholder="请输入备注" class="layui-input">
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                            变电站图片
                                            <hr class="layui-bg-blue">
                                            <div class="layui-row">
                                                <div class="layui-col-md12">
                                                    <div class="layui-collapse">
                                                        <div class="layui-colla-item">
                                                            <h2 class="layui-colla-title">限制规则：</h2>
                                                            <div class="layui-colla-content">
                                                                <p>1.要求：本人正面照片，内容合规合法；</p>
                                                                <p>2.格式：jpg、png、bmp、jpeg</p>
                                                                <p>3.尺寸：91x91</p>
                                                                <p>4.大小：少于2MB</p>
                                                            </div>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="layui-row">
                                                <div class="layui-col-md1">
                                                    &nbsp;
                                                </div>
                                                <div class="layui-col-md10">
                                                    <div class="layui-upload-drag" id="substationPicture">
                                                        <i class="layui-icon">&#xe681;</i>
                                                        <p>点击上传，或将文件拖拽到此处</p>
                                                    </div>
                                                </div>
                                                <div class="layui-col-md1">
                                                    &nbsp;
                                                </div>
                                            </div>
                                            <div class="layui-row">
                                                <div class="layui-col-md3">
                                                    &nbsp;
                                                </div>
                                                <div class="layui-col-md6">
                                                    <div class="layui-upload-list yjs-photo"
                                                         id="substationViewer">
                                                        <img class="layui-upload-img" layer-src="{{$itemData['picture']}}"
                                                             layer-pid="" src="{{$itemData['picture']}}"
                                                             alt="{{$itemData['name']}}">
                                                        <div class="yjs-photo-edit">点击查看原图</div>
                                                    </div>
                                                </div>
                                                {{--保存上传的图片路径--}}
                                                <div class="layui-col-md6" style="display:none; width: auto;">
                                                    <div class="layui-form-item">
                                                        <input type="text" name="picture" class="layui-input">
                                                    </div>
                                                </div>
                                                <div class="layui-col-md3">
                                                    &nbsp;
                                                </div>
                                            </div>
                                            <div class="layui-row">
                                                <div class="layui-col-md3">
                                                    {{--隐藏提交--}}
                                                    <button id="toolbarSubmit" type="submit" class="layui-btn"
                                                            lay-filter="toolbarEvent" lay-submit style="display: none;">
                                                    </button>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </fieldset>
                            </div>
                        </div>
                    @else
                        {{--视图类型不正确--}}
                        <div class="layui-row">
                            <div class="layui-col-md12">
                                <blockquote class="layui-elem-quote-error">
                                    友情提示：视图类型不正确，无法支持后续操作。
                                </blockquote>
                            </div>
                        </div>
                    @endif
                </div>
            @else
                <div class="layui-container">
                    <div class="layui-row">
                        <div class="layui-col-md12">
                            <blockquote class="layui-elem-quote-error">
                                友情提示：该功能只面向已成功登录系统，并具有相应权限的用户可用。
                            </blockquote>
                        </div>
                    </div>
                </div>
            @endif
        </div>
    </div>
</div>

@include('v1.common.js')
<script src="{{elixir('js/substation_item.js')}}"></script>
</body>
<script type="text/html">
    <input type="hidden" id="rspStatus" value="">
    <input type="hidden" id="rspMsg" value="">
</script>
</html>